package com.bestow.basic.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bestow.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bestow.basic.mapper.HlsDbDataSourceMapper;
import com.bestow.basic.domain.HlsDbDataSource;
import com.bestow.basic.service.IHlsDbDataSourceService;

/**
 * 通用数据源定义Service业务层处理
 * 
 * @author liliu
 * @date 2022-09-14
 */
@Service
public class HlsDbDataSourceServiceImpl extends ServiceImpl<HlsDbDataSourceMapper, HlsDbDataSource> implements IHlsDbDataSourceService
{
    @Autowired
    private HlsDbDataSourceMapper hlsDbDataSourceMapper;

    /**
     * 查询通用数据源定义
     * 
     * @param dataSourceId 通用数据源定义主键
     * @return 通用数据源定义
     */
    @Override
    public HlsDbDataSource selectHlsDbDataSourceByDataSourceId(Long dataSourceId)
    {
        return hlsDbDataSourceMapper.selectHlsDbDataSourceByDataSourceId(dataSourceId);
    }

    /**
     * 查询通用数据源定义列表
     * 
     * @param hlsDbDataSource 通用数据源定义
     * @return 通用数据源定义
     */
    @Override
    public List<HlsDbDataSource> selectHlsDbDataSourceList(HlsDbDataSource hlsDbDataSource)
    {
        return hlsDbDataSourceMapper.selectHlsDbDataSourceList(hlsDbDataSource);
    }

    /**
     * 新增通用数据源定义
     * 
     * @param hlsDbDataSource 通用数据源定义
     * @return 结果
     */
    @Override
    public int insertHlsDbDataSource(HlsDbDataSource hlsDbDataSource)
    {
        hlsDbDataSource.setCreateTime(DateUtils.getNowDate());
        return hlsDbDataSourceMapper.insertHlsDbDataSource(hlsDbDataSource);
    }

    /**
     * 修改通用数据源定义
     * 
     * @param hlsDbDataSource 通用数据源定义
     * @return 结果
     */
    @Override
    public int updateHlsDbDataSource(HlsDbDataSource hlsDbDataSource)
    {
        hlsDbDataSource.setUpdateTime(DateUtils.getNowDate());
        return hlsDbDataSourceMapper.updateHlsDbDataSource(hlsDbDataSource);
    }

    /**
     * 批量删除通用数据源定义
     * 
     * @param dataSourceIds 需要删除的通用数据源定义主键
     * @return 结果
     */
    @Override
    public int deleteHlsDbDataSourceByDataSourceIds(Long[] dataSourceIds)
    {
        return hlsDbDataSourceMapper.deleteHlsDbDataSourceByDataSourceIds(dataSourceIds);
    }

    /**
     * 删除通用数据源定义信息
     * 
     * @param dataSourceId 通用数据源定义主键
     * @return 结果
     */
    @Override
    public int deleteHlsDbDataSourceByDataSourceId(Long dataSourceId)
    {
        return hlsDbDataSourceMapper.deleteHlsDbDataSourceByDataSourceId(dataSourceId);
    }
}
